
package finalproject.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HTMLTable.Cell;

public class ProjectEntryPoint implements EntryPoint {
    private MenuGui menuGui;

    private StudentGui studentGui;
    private StudentClass studentClass;

    private DocentGui docentGui;
    private DocentClass docentClass;
    
    private VakGui vakGui;
    private VakClass vakClass;

    private AbsentieGui absentieGui;
    private AbsentieClass absentieClass;
    
    
    public void onModuleLoad() {

    	menuGui = new MenuGui();
    	menuGui.go();
    	wireMenuGUIEvents();

    	// studentGui aanmaken
    	studentGui = new StudentGui();
    	studentClass = new StudentClass();
    	studentGui.studentService = studentClass;
    	studentClass.gui = studentGui;
    	studentGui.go();
    	studentGui.wireEvents();
    	studentGui.hideGui();
        
    	// DocentGui aanmaken
    	docentGui = new DocentGui();
    	docentClass = new DocentClass();
    	docentGui.DocentService = docentClass;
    	docentClass.gui = docentGui;
    	docentGui.go();
    	docentGui.wireEvents();
    	docentGui.hideGui();
        
    	// vakGui aanmaken
    	vakGui = new VakGui();
    	vakClass = new VakClass();
    	vakGui.vakService = vakClass;
    	vakClass.gui = vakGui;
    	vakGui.go();
    	vakGui.wireEvents();
    	vakGui.hideGui();

        // absentieGui aanmaken
    	absentieGui = new AbsentieGui();
    	absentieClass = new AbsentieClass();
    	absentieGui.absentieService = absentieClass;
    	absentieClass.gui = absentieGui;
    	absentieGui.go();
    	absentieGui.wireEvents();
    	absentieGui.hideGui();
    }

 
    private void hideAllGui() {
        docentGui.hideGui();
        studentGui.hideGui();
        vakGui.hideGui();
        absentieGui.hideGui();
    }
    
   
    

    private void wireMenuGUIEvents() {
    	menuGui.studentButton.addClickHandler(new ClickHandler(){
            public void onClick(ClickEvent event) {
            	hideAllGui();
            	studentClass.listStudenten();
            	
            }});
    	menuGui.docentButton.addClickHandler(new ClickHandler(){
            public void onClick(ClickEvent event) {
            	hideAllGui();
            	docentClass.listDocenten();
            	
            }});
    	menuGui.vakButton.addClickHandler(new ClickHandler(){
            public void onClick(ClickEvent event) {
            	hideAllGui();
            	vakClass.listVakken();
            	
            }});
    	menuGui.absentieButton.addClickHandler(new ClickHandler(){
            public void onClick(ClickEvent event) {
            	hideAllGui();
            	absentieClass.listAbsenties();
            	
            }});    
    	}
    
}
